#pragma once
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<random>
#include<string>
#include<fstream>
#include"LCS.h"


#define MOD_VALUE 100000
#define MOD_VALUE2 100
#define CHANGE_VALUE 100
#define TEST_VALUES 100
#define WORD_LENGTH 10

long long generate_number(){
	return rand()*rand()*rand();
}
std::vector<long long> generate_sequence(){
	int cnt_words = (MOD_VALUE) + 1;
	std::vector<long long> result;
	for (int i = 0; i < cnt_words; ++i)
		result.push_back(generate_number());
	return result;
}

std::vector<long long> generate_sequence_small(){
	int cnt_words = (MOD_VALUE2)+1;
	std::vector<long long> result;
	for (int i = 0; i < cnt_words; ++i)
		result.push_back(generate_number());
	return result;
}

std::vector<long long> spoil_some_numbers(const std::vector<long long>& sequence){
	std::vector<long long> result = sequence;
	for (int i = 0; i < CHANGE_VALUE; ++i)
		result[rand()%sequence.size()] = generate_number();
	return result;
}
std::vector<long long> spoil_some_numbers_with_delete(const std::vector<long long>& sequence){
	std::vector<long long> result = sequence;
	for (int i = 0; i < CHANGE_VALUE; ++i)
		result[rand() % sequence.size()] = generate_number();
	for (int i = 0; i < CHANGE_VALUE; ++i)
		result.erase((result.begin() + rand() % result.size()));
	for (int i = 0; i < CHANGE_VALUE; ++i)
		result.insert(result.begin() + rand()%(result.size()),generate_number());
	return result;
}


char generate_character(){
	return (rand() % 26) + 'a';
}

string generate_string(){
	int cnt_letters = WORD_LENGTH;
	string result(cnt_letters,' ');
	for (int i = 0; i < cnt_letters; ++i)
		result[i] = generate_character();
	return result;
}

std::vector<std::string> spoil_some_numbers_with_delete(const std::vector<std::string>& sequence){
	std::vector<std::string> result = sequence;
	int current_value = sequence.size() / 100;
	for (int i = 0; i < current_value; ++i)
		result[rand() % sequence.size()] = generate_string();
	for (int i = 0; i < current_value; ++i)
		result.erase((result.begin() + rand() % result.size()));
	for (int i = 0; i < current_value; ++i)
		result.insert(result.begin() + rand() % (result.size()), generate_string());
	return result;
}


void generate_text(){
	std::ofstream in1("input1.txt");
	int cnt_words = rand()%MOD_VALUE+1;
	std::vector<std::string> current_result;
	for (int i = 0; i < cnt_words; ++i){
		std::string generated_string = generate_string();
		
		current_result.push_back(generate_string());
	}
	
	std::vector<std::string> result2 = spoil_some_numbers_with_delete(current_result);
	for (int i = 0; i < current_result.size(); ++i){
		in1 << current_result[i] << endl;
	}
	in1.close();
	//cerr << get_edit_distance(current_result.begin(), current_result.end(), result2.begin(), result2.end()) << endl;
	std::ofstream in2("input2.txt");
	//int cnt_words = (MOD_VALUE2)+1;

	for (int i = 0; i < result2.size(); ++i)
		in2 << result2[i] << endl;
	in2.close();
}

